package com.autocloud.model;

import lombok.Data;

/**
 * @author zhongwb
 * @version 1.0
 * @description 返回对象
 * @date 2019/12/3 8:51 下午
 */
@Data
public class Result<T> {

    private boolean success = true;
    private int status = 0;
    private T data;
    private String msg;

    public static Result ofsuccess(Object obj){
         return new Result<Object>(){{
            setData(obj);
         }};
    }

    public static Result oflost(String _msg,int status){
        return new Result<Object>(){{
           setMsg(_msg);
           setStatus(status);
        }};
    }

    public static Result oflost(int status){
        return new Result<Object>(){{
            setStatus(status);
            String msg = Config.getMsg(status);
            setMsg(msg);
        }};
    }

}
